#pragma once

#include "IXColorDraw.h"
#include "Logic/Include/XBaseObjImpl.h"


enum ColorFlags
{
    ColorFlag_Vert      = 0x1,
    ColorFlag_Horz      = 0x2,
    ColorFlag_Gradient  = 0x4,
    ColorFlag_Pure      = 0x8,
    ColorFlag_Colorize  = 0x10,
};

class CXColorDrawImpl : public CXBaseObjImpl<IXColorDraw>
{
    typedef CXBaseObjImpl<IXColorDraw> superclass;

    BEGIN_DEF_SKIN_CLASS(CXColorDrawImpl, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXColorDraw, 0)
        IMP_BASIC_INTF(IXDraw, eIntf_NoCreate)
    END_DEF_SKIN_CLASS();

public:
    CXColorDrawImpl();
    virtual ~CXColorDrawImpl();

public:
    // IXColorDraw
    virtual void STDMETHODCALLTYPE   put_Color(IN COLORREF clr);
    virtual void STDMETHODCALLTYPE   get_Color(OUT LPCOLORREF pclr);

    virtual void STDMETHODCALLTYPE   put_GradientColor(IN COLORREF clrStart, IN COLORREF clrEnd);
    virtual void STDMETHODCALLTYPE   get_GradientColor(OUT LPCOLORREF pclrStart, OUT LPCOLORREF pclrEnd);

    virtual void STDMETHODCALLTYPE   put_Direction(IN BOOL bHorz);
    virtual void STDMETHODCALLTYPE   get_Direction(OUT LPBOOL pbHorz);

    // IXDraw
    virtual HRESULT STDMETHODCALLTYPE   Draw(IN XCANVAS xCanvas, IN const RECT* lpDes);
    virtual HRESULT STDMETHODCALLTYPE   Draw(IN XCANVAS xCanvas, IN const RECT* lpSrc, IN const RECT* lpDes);
    virtual BOOL    STDMETHODCALLTYPE   IsDrawValid();

    virtual void    STDMETHODCALLTYPE   EnableColorize(IN BOOL bEnable);
    virtual void    STDMETHODCALLTYPE   Colorize(IN int hue, IN int sat, IN int light);

protected:
    DWORD       m_dwFlags;
    COLORREF    m_clrStart;
    COLORREF    m_clrEnd;

    int         m_hue;
    int         m_sat;
    int         m_light;};


